{extend name="template/base_default"}
{block name="header"}
<link rel="stylesheet" href="__CSS__/common.css">
<link rel="stylesheet" href="__CSS__/weui.min.css">
<link rel="stylesheet" href="__CSS__/index.css">
<link rel="stylesheet" href="__CSS__/weuix.min.css"/>
<script src="__JS__/zepto.min.js"></script>
<script src="__JS__/lrz.min.js"></script>
<style>

    .form-head{
        color: white;
        font-size: 16px;
        background-color: rgba(95, 110, 170, 0.4);
        border-radius: 5px;
        overflow: hidden;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    body{
        background-image:url("__IMG__/bj.png");
        background-repeat:no-repeat;
        background-size:cover;
        text-align: center;
        background-attachment:fixed;
    }
    button{
        border: none;
        color:white;
        width:100%;
        float:left;
        height: 100%;
        font-size: 18px;
        font-family: "Microsoft YaHei UI";
    }
    .botton1{
        background-color: #FF0000;
    }
    .botton2{
        background-color: #131a34;
    }
</style>
{/block}
{block name="body"}

<form action="{:url('login/register')}" method="post" style="width:95%;margin: auto;margin-top: 20px">
    <div class="form-head">
        <div class="form-input3" >
            <label for="name" class="form-input3-label">姓名:</label>
            <input class="form-input3-input" style="padding-left: 10px" id="name" name="name" type="text" value="{$person_info['name']}" readonly placeholder=" ">
        </div>

        <div class="form-input3">
            <label for="name" class="form-input3-label">手机号码:</label>
            <input class="form-input3-input" style="padding-left: 10px" id="mobile" name="mobile" type="text" value="{$person_info['mobile']}" readonly placeholder="">
        </div>
    </div>

    {eq name="platform_type" value="3"}
    <div style="position:fixed;bottom:0;left:0;width:100%;height:50px;">
        <button id="delete" class="bottom-btn botton1" type="button">删除</button>
    </div>
    {/eq}
</form>
{/block}
{block name="footer"}
<script type="text/javascript" src="__JS__/public.js"></script>
<script>
    $(function(){
        $('.headimgurl').change(function () {
            var v_this = $(this);
            lrz(this.files[0],{width:640,fieldName:"image"}).then(function (rst) {
                var formdata = new FormData();
                v_this.parent().css("background-image","url("+rst.base64+")");//无论是否上传成功都显示
                url = "__BASE__/web.php/file/upload_picture_base64";
                formdata.append("image", rst.base64);
                $.ajax({
                    url : url,
                    type : 'post',
                    data : formdata,
                    contentType : false,
                    processData : false,
                    dataType : "json",
                    success : function(data) {
                        if (data.status == true) {
                            $.toast("图片上传成功");
                            v_this.next().val(data.info[0]['id']);
                        }
                    },
                    error:function(){
                        $.toast("图片上传失败");
                    }
                });
                return false;
            })
        });
    })

    $('#submit').click(function () {

        var body  ={
            name:$('#name').val(),
            mobile:$('#mobile').val()

        };
        var $this = $(this);
        $this.addClass('weui-btn_disabled').attr('disabled','disabled');
        ajax_post(getBaseUrl()+'web.php/extension/edit_shop',jQuery.param(body),{
            success:function(data){
                $.toast("添加成功",'success');
                $this.removeClass('weui-btn_disabled').removeAttr("disabled");
//                    setTimeout(
//                            function(){
//                                window.location.href=getBaseUrl()+'web.php/index/index.html';
//                            }
//                            ,1500);
            },
            error:function(data){
                $.toptip(data.data, 'error');
                $this.removeClass('weui-btn_disabled').removeAttr("disabled");
            }
        })


    });


    $('#delete').click(function () {

        var body  ={
            platform_id:"{$platform_id}",
            del:'del',
            platform_father:"{$platform_father}"
        };
        var $this = $(this);
        $this.addClass('weui-btn_disabled').attr('disabled','disabled');
        ajax_post(getBaseUrl()+'web.php/extension/edit_person',jQuery.param(body),{
            success:function(data){
                $.toast("已发起删除请求",'success');
                $this.removeClass('weui-btn_disabled').removeAttr("disabled");
                setTimeout(
                    function(){
                        history.back(-1);
                    }
                    ,1500);
            },
            error:function(data){
                $.toptip(data.data, 'error');
                $this.removeClass('weui-btn_disabled').removeAttr("disabled");
            }
        })


    });
</script>
{/block}